package com.example.user

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.alibaba.android.arouter.launcher.ARouter

/**
 * 全局降级策略：当给出的路径找不到对应界面时，可跳转到 Error界面
 */
@Route(path = "/service/degrade")
class MyDegradeService:DegradeService {
    override fun init(context: Context?) {
        //初始化 暂不做处理
    }

    override fun onLost(context: Context?, postcard: Postcard?) {
        //当路径输入错误
        //统一跳转到指定界面
        ARouter.getInstance().build("/app/ErrorActivity").navigation()
    }
}